﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TangoGames.Base;
using TangoGames.Scene;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace incubation_xna3d.Scene
{
    class Enemie : GameObject3D, IEnemie
    {

        #region Fields

        /// <summary>
        /// Posição no tabuleiro
        /// </summary>
        Point boardPosition;

        /// <summary>
        /// Gerenciador da cena corrente
        /// </summary>
        ISceneManager sceneManager;

        #endregion

        #region Properties

        /// <summary>
        /// Posição no tabuleiro
        /// </summary>
        public Point BoardPosition { get { return boardPosition; } set { boardPosition = value; } }

        /// <summary>
        /// Caixa de colisão
        /// </summary>
        public BoundingBox CollisionBox { get { return ModelBoundingBox; } }

        /// <summary>
        /// Gerenciador da cena corrente
        /// </summary>
        public ISceneManager SceneManager { get { return sceneManager; } set { sceneManager = value; } }

        #endregion

        #region Constructor

        public Enemie(Game game, ICamera camera)
            : base(game, camera, game.Content.Load<Model>("Models/Enemies/dino videogame"))
        {
            this.Scale = 20.0f;
            this.Position = new Vector3(0, 8.0f, 0);
            UpdateWorld();
        }

        #endregion

        #region Methods

        /// <summary>
        /// Atualiza posição do tabuleiro para posição real
        /// </summary>
        /// <param name="pathMap"></param>
        public void UpdateBoardPosition(IPathMap pathMap) 
        {
            Point ini = pathMap.ReversePoint(new Vector2(Position.X, Position.Z));
            Vector2 inireal = pathMap.ConvertPoint(ini);
            boardPosition = ini;
        }

        /// <summary>
        /// centraliza posição no quadrado do tabuleiro
        /// </summary>
        /// <param name="pathMap"></param>
        public void CenterPositionBoardSquare(IPathMap pathMap)
        {
            Vector2 centerPoint = pathMap.ConvertPoint(boardPosition);
            this.Position = new Vector3(centerPoint.X, this.Position.Y, centerPoint.Y);
        }

        #endregion

        #region Update
        #endregion

        #region Draw
        #endregion

    }
}
